{{- $params := site.Params }}
{{- $pl := .Permalink }}
{{ $st := site.Title }}
{{- $summary := "" }}
{{- with .Summary }}
  {{-  $summary = . }}
{{- else  }}
  {{- $summary = $params.description }}
{{- end }}
{{- $summary = truncate 160 "" $summary }}
{{- $logo := absURL (printf "images/%s" $params.logo) }}
{{- if in $params.logo "https://" }}
  {{- $logo = $params.logo }}
{{- end }}
{{ $image := "" }}
{{- with .Params.image }}
  {{ if in . "https://" }}
    {{- $image = . }}
  {{ else }}
    {{- $image = absURL (printf "images/%s" .) }}
  {{ end }}
{{- else }}
  {{- $image = $logo }}
{{- end }}
<meta name="keywords" content="{{ $st }}">
<meta property="og:locale" content='{{ default "en_US" $params.locale }}'>
<meta property="og:type" content="article">
<meta property="og:title" content="{{ .Title }}">
<meta property="og:description" content="{{ $summary }}">
<meta property="og:url" content="{{ $pl }}">
<meta property="og:image" content="{{ $image }}">
{{- if eq .Section "blog" -}}
  {{- $date := .Date.Format "2006-02-01" -}}
  <meta property="article:published_time" content="{{ htmlUnescape $date }}" />
  <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "BlogPosting",
      "mainEntityOfPage":"{{ $pl }}",
      "name": "{{ $st }}",
      "headline": "{{ .Title  }}",
      "description": "{{ $summary }}",
      "url": "{{ $pl }}",
      "datePublished": "{{ $date }}",
      "dateModified": "{{ $date }}",
      "author": {
        "@type": "Person",
        "name": "{{ .Params.author }}"
      },
      "image":{
        "@type":"ImageObject",
        "url": "{{ $image }}"
      },
      "publisher": {
        "@type": "Organization",
        "logo": {
          "@type":"ImageObject",
          "url": "{{ $logo }}"
        },
        "name": "{{ $st }}"
      }
    }
  </script>
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:creator" content="{{ $params.twitter }}">
  <meta name="twitter:title" content="{{ .Title }}">
  <meta name="twitter:description" content="{{ $summary }}">
  <meta name="twitter:image" content="{{ $image }}">
{{- end }}
<link rel="canonical" href="{{ $pl }}">
